/*
 * @Author: sunkai@xinxinapp.cn
 * @Date: 2021-05-27 16:45:58
 * @LastEditTime: 2021-05-27 17:17:31
 * @LastEditors: sunkai@xinxinapp.cn
 * @Description: 
 * @FilePath: /adangular/src/app/cart.services.ts
 */
export class CartService {
  items: any = ['张三', '李四', '王五', '赵柳']

  addToCart (product: any) {
    this.items.push(product)
  }

  getItems () {
    return this.items
  }

  delCart (_name: string) {
    console.log(_name)
    const index = this.items.indexOf(_name)
    if (index === -1) return
    this.items.splice(index, 1)
  }
  
}